<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('资料文件夹管理者分配')" />
    <link th:href="@{/js/layuiadmin-1.2.1/lib/extend/soulTable/soulTable.css}" rel="stylesheet"/>
</head>
<body>
<div style="padding: 10px;">
    <p>拖动行排序</p>
    <table class="layui-hide" id="dhtable" lay-filter="ftable"></table></div>

<script th:src="@{/js/jquery/jquery.min.js}"></script>
<script th:src="@{/js/layuiadmin-1.2.1/layui/layui.js}"></script>
<script th:src="@{/js/jquery/jquery.blockUI.min.js}"></script>
<script th:src="@{/dhecp/js/dh-ui.js}"></script>
<script>
/*<![CDATA[*/
var pguid = "[[${pguid}]]";
/*]]>*/
layui.config({
    base: '/js/layuiadmin-1.2.1/lib/extend/soulTable/',   // 模块目录
    version: 'v1.3.20'
}).extend({                         // 模块别名
    soulTable: 'soulTable'
});
var tableFilter,table;
layui.use('tableFilter', function() {
    tableFilter = layui.tableFilter
})
layui.use(['table','layer','jquery','soulTable'], function () {
    var $ = layui.$,layer = layui.layer,soulTable = layui.soulTable;
    table = layui.table;
    table.render({
        elem: '#dhtable',
        url: "/system/datafolder/list?pguid="+pguid,
        height:250,
        width:280,
        cellMinWidth: 60,
        drag: {toolbar: true},
        title: '友情链接表',
        rowDrag: {
            numbers: true
            ,trigger: '.layui-table-cell'
            ,done: function (obj) {
                var data = obj.cache;
                if (data.length > 0) {
                    for (i = 0; i < data.length; i++) {
                        data[i].iid = data[i].LAY_TABLE_INDEX + 1;
                    }
                }
                // $.operate.post("/system/datafolder/updateiidbyguid", {'infoItems':JSON.stringify(data)},function(result){
                //     console.log(result);
                // });
            }
        },
        soulSort: false,
        cols: [[
            {type:'numbers', fixed: 'left'},
            {field: 'folderName', title: '名称', sort: true}
        ]
        ],
        id: 'dhtable',
        filter: {
            items: ['column', 'clearCache']
            , bottom: false
            , cache: true
        },
        done: function (res, curr, count) {
            soulTable.render(this);
        }
    })
});

var callbackdata = function () {
    var data = table.cache.dhtable;
    return data;
}
</script>
</body>
</html>